/**
 * <p>Copyright (c) 2017 深圳市鹏途交通科技有限公司 </p>
 * <p>				   All right reserved. 		     </p>
 * 
 * <p>项目名称 ： 	         </p>
 * <p>创建者   :	win7 
 * 
 * <p>描   述  :   NCRoadConstructionServiceImpl.java for com.pengtu.gsj.service.impl.gcjs    </p>
 * 
 * <p>最后修改 : $: 2017年6月27日-下午5:32:59 v 1.0.0	 win7   $ </p>
 * 
*/

package com.pengtu.gsj.service.impl.gcjs;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pengtu.gsj.dao.base.Page;
import com.pengtu.gsj.dao.base.QueryFilter;
import com.pengtu.gsj.dao.check.gcjs.NCRoadConstructionDao;
import com.pengtu.gsj.entity.app.Attachment;
import com.pengtu.gsj.entity.gcjs.NCRoadConstruction;
import com.pengtu.gsj.service.gcjs.NCRoadConstructionService;
import com.pengtu.gsj.service.system.SystemManageService;

/**
 * 
 * NCRoadConstructionServiceImpl
 * 
 * 2017年6月27日 下午5:32:59
 * 
 * @version 1.0.0
 * 
 */

@Transactional
@Service
public class NCRoadConstructionServiceImpl implements NCRoadConstructionService{
	
	@Autowired
	private NCRoadConstructionDao nCRoadConstructionDao;
	
	@Autowired
	private SystemManageService systemManageService;
	
	@Override
	public void saveNCRoadConstruction(NCRoadConstruction nCRoadConstruction){
		nCRoadConstructionDao.save(nCRoadConstruction);
	}
	
	@Override
	public Page<NCRoadConstruction> findNCRoadConstruction(Page<NCRoadConstruction> page, final QueryFilter queryFilter){
		return nCRoadConstructionDao.findPage(page, queryFilter);
	}
	
	@Override
	public NCRoadConstruction getNCRoadConstructionById(String id){
		return nCRoadConstructionDao.get(id);
	}
	
	@Override
	public void  delateNCRoadConstruction(NCRoadConstruction nCRoadConstruction){
		if(nCRoadConstruction.getAttachments() != null){
			for(Attachment attachment : nCRoadConstruction.getAttachments()){
				systemManageService.deleteAttachment(attachment);
			}
		}
		nCRoadConstructionDao.delete(nCRoadConstruction);
	}
}
